package com.learner.major.service;

import com.learner.major.repository.LwRepository;
import com.learner.pojo.major.ProgramVoiceRank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LwService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Autowired
    private LwRepository lwRepository;

    /**
     * 获取编程语言排行榜单
     *
     * @return ProgramVoiceRank
     */
    public List<ProgramVoiceRank> getAll() {
        return lwRepository.findAll();
    }


    /**
     * 保存编程语言排序
     *
     * @param lw 语言排行数据
     * @return ProgramVoiceRank
     */
    public ProgramVoiceRank save(ProgramVoiceRank lw) {
        return lwRepository.save(lw);
    }
}
